﻿@model IEnumerable<kxcxw.Data.Entities.PublichInformation>
@using KXCXW.Web.CommonClass
@using KXCXW.Web.CommonClass.Ext
@using kxcxw.Data.Common
<div class="content line_01">
    <ul>
        @if (Model != null && Model.Count() > 0)
        {
            int count = 0;
            foreach (var item in Model)
            {
                var url = item.InfoType == 1 ? item.ShopUrl : Url.Action("ProductDetails", "Home", new { id = item.InformationID });
                count++;
            <li class="product"><a href="@url" target="_blank" class="pic line_01 @(item.InfoType == 1 ? "weburl" : "")" productId="@item.InformationID">
                <img src="@Url.Content(ImgHelper.ImgFoldUrl(ImgHelper.img90) + (string.IsNullOrEmpty(item.MapUrl) ? "nullImage.jpg" : item.MapUrl))" alt="@item.Title" /></a>
                <div class="rightinfo">
                    <a href="@url" target="_blank" class="red @(item.InfoType == 1 ? "weburl" : "")" productId="@item.InformationID">@Html.Truncate(item.Title, 15)</a> <a  href="@url" target="_blank" class="btnbuy @(item.InfoType == 1 ? "weburl" : "")">
                    </a>
                    @if (item.PromotionType == DataConstants.PanicBuying)
                    {
                        TimeSpan ts = new TimeSpan();
                        int days = 30;
                        if (item.EndDate != null)
                        {
                            ts = item.EndDate.Value - DateTime.Now;
                            days = Convert.ToInt32(ts.TotalDays);
                        }
                        <span>抢购价：￥@item.PresentPrice</span>
                        <span>剩余：<b>@days.ToString()</b>天</span>
                    }
                    else if (item.PromotionType == DataConstants.Discount)
                    {
                        <span class="oldprice">原价：￥@item.OriginalPrice</span> 
                        <span class="currentprice">折扣价：￥ @item.PresentPrice</span>
                                                    if (item.Discount <= 8)
                                                    {
                        <div class="discount red">
                            <span>@string.Format("{0:0.0}", item.Discount)</span>
                            <p>
                                折</p>
                        </div>
                                                    }
                    }
                    else if (item.PromotionType == DataConstants.PriceReduction)
                    {
                        decimal sheng = item.OriginalPrice - item.PresentPrice;
                        <s>原价：￥@item.OriginalPrice</s> 
                        <span>处理价：￥@item.PresentPrice</span> 
                        <div class="discount red PriceReduction">
                            <p>
                                省</p>
                            <span>@string.Format("{0:0}", sheng)</span>
                        </div>
                    }
                    else if (item.PromotionType == DataConstants.BuyAdd)
                    {
                        <span>价格：￥@item.PresentPrice</span> 
                        <div class="discount red BuyAdd">
                            <s>购赠</s>
                        </div>
                    }
                    else if (item.PromotionType == DataConstants.Clearance)
                    {
                        <s>原价：￥@item.OriginalPrice</s> 
                        <span>清仓价：￥@item.PresentPrice</span> 
                        <div class="discount red BuyAdd">
                            <s>清仓</s>
                        </div>
                    }
                </div>
                @if (count != Model.Count())
                {
                    <div class="line_02">
                    </div> 
                }
            </li>
          
            }
        }
    </ul>
</div>
